<template>
	<view class="apply">
		<view class="nodata" v-if="!nodata">没有申请记录</view>
		<view class="panel" v-if="data.time && nodata">
			<view class="panel-top van-hairline--bottom">
				<view class="panel-top-title">
					<text class="title">商家申请</text>
					<text class="status" :style="{color: applyStatus[data.status].color}">{{applyStatus[data.status].name}}</text>
				</view>
				<text class="panel-top-time">{{data.time}}</text>
			</view>
			<van-cell
				title="姓名"
				:value="data.name"
			  />
			  <van-cell
				title="手机号码"
				:value="data.tel"
			  />
			  <van-cell
				title="身份证号"
				:value="data.idcard"
			  />
			  <van-cell
				title="行业"
				:value="data.industry"
			  />
			  <van-cell
				title="城市"
				:value="data.city"
			  />
			   <van-cell
				title="申请LAB数量"
				:value="data.needlab"
			  />
			  <van-cell
				title="简介"
				:label="data.jianjie"
				:border="false"
			  />
			</van-cell-group>
		</view>
	</view>
</template>

<script>
import { mapActions, mapGetters } from 'vuex';
export default {
	data() {
		return {
			data: '',
			nodata: false,
			applyStatus:[
				{
					name: '审核中',
					color: '#f4544d'
				},
				{
					name: '申请成功',
					color: '#6eb92b'
				},
				{
					name: '申请驳回',
					color: '#d8002a'
				}
			]
		};
	},
	onLoad() {},
	onShow() {
		uni.showLoading({
		    title:''
		})
		this.applyStoreStatus()
	},
	computed: {
		...mapGetters({
			userInfo: 'getUserInfo'
		})
	},
	methods: {
		applyStoreStatus() {
			this.$http.applyStoreStatus({
				uid: this.userInfo.id
			}).then(e => {
				if (e.data) {
					this.nodata = true
					this.data = e.data
				} else {
					this.data = {}
					this.nodata = false
				}
				uni.hideLoading()
				console.log(e)
			}).catch(err => {
				this.data = {}
				this.nodata = false
				uni.hideLoading()
			})
		}
	}
};
</script>

<style lang="scss" scoped>
.apply {padding: 30upx;}
.nodata {
	text-align: center;
	color: #9b9b9b;
}
.panel {
	border-radius: 10upx;
	overflow: hidden;
	&-top {
		padding: 24upx 0;
		background-color: #fff;
		border-bottom: 1upx solid #eee;
		&-title {
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 0 30upx;
			font-size: 36upx;
			text{
				display: block;
			}
			.status {
				font-size: 32upx;
				color: #999;
			}
		}
		&-time {
			padding: 0 30upx;
			color:#999;
		}
	}
}
</style>
